package com.handinglian.ai.callin.service.impl;

import com.handinglian.ai.callin.entity.CallInBusiness;
import com.handinglian.ai.callin.mapper.CallInBusinessMapper;
import com.handinglian.ai.callin.service.CallInBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.Future;

@Service
public class CallInBusinessServiceImpl implements CallInBusinessService {
    @Autowired
    private CallInBusinessMapper callInBusinessMapper;

    @Override
    @Transactional
    @Async
    public Future<Integer> create(CallInBusiness callInBusiness) {
        return new AsyncResult<>(callInBusinessMapper.insertSelective(callInBusiness));
    }

    @Override
    public List<CallInBusiness> list(String callid) {
        return callInBusinessMapper.findByCallid(callid);
    }
}
